(function() {
    browser = function() {
        return new _browser()
    };
    var _browser = (function() {
        var _browser = function() {
            var self = this;
            self.init()
        };
        _browser.prototype = {
            ua: null,
            language: null,
            version: null,
            safari: null,
            webkit: null,
            opera: null,
            msie: null,
            chrome: null,
            mozilla: null,
            sogou: null,
            maxthon: null,
            android: null,
            blackberry: null,
            iPad: null,
            iPhone: null,
            iPod: null,
            iOS: null,
            is3dSupported: null,
            isCSSTransformSupported: null,
            isTouchSupported: null,
            isGestureSupported: null,
            cssType: null,
            init: function() {
                var self = this;
                self.ua = window.navigator.userAgent;
                self.os = self.getOS();
                self.language = self.getLanguage(window.navigator);
                self.version = (self.ua.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || []);
                self.safari = (/Safari/gi).test(window.navigator.appVersion);
                self.webkit = /webkit/i.test(self.ua);
                self.opera = /opera/i.test(self.ua);
                self.msie = /msie/i.test(self.ua) && !this.opera;
                self.chrome = /Chrome/i.test(self.ua);
                self.firefox = /Firefox/i.test(self.ua);
                self.fennec = /Fennec/i.test(self.ua);
                self.mozilla = /mozilla/i.test(self.ua) && !/(compatible|webkit)/i.test(self.ua);
                self.sogou = self.ua.indexOf("SE") > -1 && self.ua.indexOf("MetaSr") > -1;
                self.maxthon = (typeof window.external != 'undefined' && typeof window.external != 'unknown') && (typeof window.external.max_version != 'undefined' && typeof window.external.max_version != 'unknown') && window.external.max_version.substr(0, 1).length > 0;
                self.android = /android/i.test(self.ua);
                self.blackberry = /blackberry/i.test(self.ua);
                self.iOS = (/iphone|ipod|ipad/gi).test(window.navigator.platform);
                self.iPad = (/ipad/gi).test(window.navigator.platform);
                self.iPhone = (/iphone/gi).test(window.navigator.platform);
                self.iPod = (/ipod/gi).test(window.navigator.platform);
                self.cssType = self.webkit ? "webkit": (self.mozilla ? "moz": self.opera ? "o": "ms");
                var testEl = document.createElement('div');
                self.is3dSupported = !self.isUndefined(testEl.style.perspective) || !self.isUndefined(testEl.style.WebkitPerspective) || !self.isUndefined(testEl.style.MozPerspective) || !self.isUndefined(testEl.style.OPerspective) || !self.isUndefined(testEl.style.MsPerspective);
                self.isCSSTransformSupported = !self.isUndefined(testEl.style.WebkitTransform) || !self.isUndefined(testEl.style.MozTransform) || !self.isUndefined(testEl.style.OTransform) || !self.isUndefined(testEl.style.transformProperty);
                self.isTouchSupported = self.isEventSupported('touchstart');
                self.isGestureSupported = self.isEventSupported('gesturestart')
            },
            getLanguage: function(nav) {
                var _languages = (typeof nav.language == "undefined" ? nav.browserLanguage: nav.language).split("-");
                var _language = _languages[0];
                if (_languages.length > 1) {
                    _language = _languages[0] + "_" + _languages[1].toUpperCase()
                }
                if (_language != "zh_CN" && _language != "zh_TW" && _language != "zh" && _language != "de" && _language != "de_DE") {
                    _language = "en"
                } else if (_language == "zh") {
                    _language = "zh_CN"
                } else if (_language == "de_DE") {
                    _language = "de"
                }
                return _language
            },
            getOS: function() {
                var self = this;
                var isWin = (window.navigator.platform == "Win32") || (window.navigator.platform == "Windows");
                var isMac = (window.navigator.platform == "Mac68K") || (window.navigator.platform == "MacPPC") || (window.navigator.platform == "Macintosh") || (window.navigator.platform == "MacIntel");
                if (isMac) {
                    return "Mac"
                }
                var isUnix = (window.navigator.platform == "X11") && !isWin && !isMac;
                if (isUnix) {
                    return "Unix"
                }
                var isLinux = (String(window.navigator.platform).indexOf("Linux") > -1);
                if (isLinux) {
                    return "Linux"
                }
                if (isWin) {
                    var isWin2K = self.ua.indexOf("Windows NT 5.0") > -1 || self.ua.indexOf("Windows 2000") > -1;
                    if (isWin2K) {
                        return "Win2000"
                    }
                    var isWinXP = self.ua.indexOf("Windows NT 5.1") > -1 || self.ua.indexOf("Windows XP") > -1;
                    if (isWinXP) {
                        return "WinXP"
                    }
                    var isWin2003 = self.ua.indexOf("Windows NT 5.2") > -1 || self.ua.indexOf("Windows 2003") > -1;
                    if (isWin2003) {
                        return "Win2003"
                    }
                    var isWin2003 = self.ua.indexOf("Windows NT 6.0") > -1 || self.ua.indexOf("Windows Vista") > -1;
                    if (isWin2003) {
                        return "WinVista"
                    }
                    var isWin2003 = self.ua.indexOf("Windows NT 6.1") > -1 || self.ua.indexOf("Windows 7") > -1;
                    if (isWin2003) {
                        return "Win7"
                    }
                }
                return "unknow"
            },
            isUndefined: function(value) {
                return typeof value == "undefined" ? true: false
            },
            isEventSupported: function(eventName) {
                var self = this;
                var _eventTagNames = {
                    'select': 'input',
                    'change': 'input',
                    'submit': 'form',
                    'reset': 'form',
                    'error': 'img',
                    'load': 'img',
                    'abort': 'img'
                };
                var el = document.createElement(_eventTagNames[eventName] || 'div'),
                isSupported;
                eventName = 'on' + eventName;
                if (!isSupported) {
                    el.setAttribute(eventName, 'return;');
                    isSupported = typeof el[eventName] === 'function'
                }
                el = null;
                return isSupported
            }
        };
        return _browser
    })()
})();
var _browser = browser();